1 package com.iluwatar; 2 3 /** 4 * 5 * Peaceful state. 6 * 7 */ 8 public class PeacefulState implements State { 9 10 private Mammoth mammoth; 11 12 public PeacefulState(Mammoth mammoth) { 13 this.mammoth = mammoth; 14 } 15 16 @Override 17 public void observe() { 18 System.out.println(String.format("%s is calm and peaceful.", mammoth)); 19 } 20 21 @Override 22 public void onEnterState() { 23 System.out.println(String.format("%s calms down.", mammoth)); 24 } 25 26 }